Imports System 
Imports System.Text 
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Configuration 
Imports System.Xml 
Imports System.Xml.Serialization
Imports SubSonic 
Imports SubSonic.Utilities
Namespace Data
	''' <summary>
	''' Strongly-typed collection for the AspnetPersonalizationAllUsers class.
	''' </summary>
	<Serializable> _
	Public Partial Class AspnetPersonalizationAllUsersCollection 
	Inherits ActiveList(Of AspnetPersonalizationAllUsers, AspnetPersonalizationAllUsersCollection)
	    Public Sub New()
		End Sub
	End Class
	''' <summary>
	''' This is an ActiveRecord class which wraps the aspnet_PersonalizationAllUsers table.
	''' </summary>
	<Serializable> _
	Public Partial Class AspnetPersonalizationAllUsers 
	Inherits ActiveRecord(Of AspnetPersonalizationAllUsers)
		#Region ".ctors and Default Settings"
		
		Public Sub New()
			SetSQLProps()
			InitSetDefaults()
			MarkNew()
		End Sub
		
		Public Sub New(ByVal useDatabaseDefaults As Boolean)
			SetSQLProps()
			If useDatabaseDefaults = True Then
				ForceDefaults()
			End If
			MarkNew()
		End Sub
		Public Sub New(ByVal keyID As Object)
			SetSQLProps()
			InitSetDefaults()
			LoadByKey(keyID)
		End Sub
		Public Sub New(ByVal columnName As String, ByVal columnValue As Object)
			SetSQLProps()
			InitSetDefaults()
			LoadByParam(columnName,columnValue)
		End Sub
		Private Sub InitSetDefaults()
			SetDefaults()
		End Sub
		
		Protected Shared Sub SetSQLProps()
			GetTableSchema()
		End Sub
		#End Region
		
		#Region "Schema and Query Accessor"
		
		Public Shared ReadOnly Property Schema() As TableSchema.Table
			Get
				If BaseSchema Is Nothing Then
					SetSQLProps()
				End If
				Return BaseSchema
			End Get
		End Property
		Private Shared Sub GetTableSchema()
			If (Not IsSchemaInitialized) Then
				'Schema declaration
				Dim schema As TableSchema.Table = New TableSchema.Table("aspnet_PersonalizationAllUsers", TableType.Table, DataService.GetInstance("ClubStarterKitData"))
				schema.Columns = New TableSchema.TableColumnCollection()
				schema.SchemaName = "dbo"
				'columns
				
                
                Dim colvarPathId As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarPathId.ColumnName = "PathId"
                colvarPathId.DataType = DbType.Guid
                colvarPathId.MaxLength = 0
                colvarPathId.AutoIncrement = false
                colvarPathId.IsNullable = false
                colvarPathId.IsPrimaryKey = true
                colvarPathId.IsForeignKey = true
                colvarPathId.IsReadOnly = false
                
                
				colvarPathId.ForeignKeyTableName = "aspnet_Paths"
                
                schema.Columns.Add(colvarPathId)
                
                Dim colvarPageSettings As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarPageSettings.ColumnName = "PageSettings"
                colvarPageSettings.DataType = DbType.Binary
                colvarPageSettings.MaxLength = 2147483647
                colvarPageSettings.AutoIncrement = false
                colvarPageSettings.IsNullable = false
                colvarPageSettings.IsPrimaryKey = false
                colvarPageSettings.IsForeignKey = false
                colvarPageSettings.IsReadOnly = false
                
                
                schema.Columns.Add(colvarPageSettings)
                
                Dim colvarLastUpdatedDate As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarLastUpdatedDate.ColumnName = "LastUpdatedDate"
                colvarLastUpdatedDate.DataType = DbType.DateTime
                colvarLastUpdatedDate.MaxLength = 0
                colvarLastUpdatedDate.AutoIncrement = false
                colvarLastUpdatedDate.IsNullable = false
                colvarLastUpdatedDate.IsPrimaryKey = false
                colvarLastUpdatedDate.IsForeignKey = false
                colvarLastUpdatedDate.IsReadOnly = false
                
                
                schema.Columns.Add(colvarLastUpdatedDate)
                
				BaseSchema = schema
				
				'add this schema to the provider
                'so we can query it later
                DataService.Providers("ClubStarterKitData").AddSchema("aspnet_PersonalizationAllUsers",schema)
			End If
		End Sub
		Public Shared Function CreateQuery() As Query
			Return New Query(Schema)
		End Function
		
		#End Region
		
		#Region "Props"
	
          
        <XmlAttribute("PathId")> _
        Public Property PathId As Guid 
			Get
				Return GetColumnValue(Of Guid)("PathId")
			End Get
		    
			Set
				SetColumnValue("PathId", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("PageSettings")> _
        Public Property PageSettings As Byte() 
			Get
				Return GetColumnValue(Of Byte())("PageSettings")
			End Get
		    
			Set
				SetColumnValue("PageSettings", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("LastUpdatedDate")> _
        Public Property LastUpdatedDate As DateTime 
			Get
				Return GetColumnValue(Of DateTime)("LastUpdatedDate")
			End Get
		    
			Set
				SetColumnValue("LastUpdatedDate", Value)
			End Set
		End Property
		
		
		
		
		#End Region
		
		
			    
	    
		
		
		
		
		
	    
	    #Region "ForeignKey Methods"
	    
		''' <summary>
		''' Returns a AspnetPaths ActiveRecord object related to this AspnetPersonalizationAllUsers
		''' </summary>
		Public Property AspnetPaths() As Data.AspnetPaths
			Get
				Return Data.AspnetPaths.FetchByID(Me.PathId)
			End Get
			Set
				SetColumnValue("PathId", Value.PathId)
			End Set
		End Property
	    
	    #End Region
	    
		
	    
	    'no ManyToMany tables defined (0)
	    
		
		#Region "ObjectDataSource support"
		
		''' <summary>
		''' Inserts a record, can be used with the Object Data Source
		''' </summary>
		Public Shared Sub Insert(ByVal varPathId As Guid,ByVal varPageSettings As Byte(),ByVal varLastUpdatedDate As DateTime)
			Dim item As AspnetPersonalizationAllUsers = New AspnetPersonalizationAllUsers()
			
            item.PathId = varPathId
            
            item.PageSettings = varPageSettings
            
            item.LastUpdatedDate = varLastUpdatedDate
            
			If Not System.Web.HttpContext.Current Is Nothing Then
				item.Save(System.Web.HttpContext.Current.User.Identity.Name)
			Else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name)
			End If
		End Sub
		''' <summary>
		''' Updates a record, can be used with the Object Data Source
		''' </summary>
		Public Shared Sub Update(ByVal varPathId As Guid,ByVal varPageSettings As Byte(),ByVal varLastUpdatedDate As DateTime)
			Dim item As AspnetPersonalizationAllUsers = New AspnetPersonalizationAllUsers()
		    
                item.PathId = varPathId
				
                item.PageSettings = varPageSettings
				
                item.LastUpdatedDate = varLastUpdatedDate
				
			item.IsNew = False
			If Not System.Web.HttpContext.Current Is Nothing Then
				item.Save(System.Web.HttpContext.Current.User.Identity.Name)
			Else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name)
			End If
		End Sub
		#End Region
		#Region "Columns Struct"
		Public Structure Columns
			Dim x as Integer
			
            Public Shared PathId As String = "PathId"
            
            Public Shared PageSettings As String = "PageSettings"
            
            Public Shared LastUpdatedDate As String = "LastUpdatedDate"
            
		End Structure
		#End Region
	End Class
End Namespace
